<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>个人信息</title>
    <link rel="stylesheet" href="../../css/aui.css" />
    <link rel="stylesheet" href="../../css/iconfont/iconfont.css" />
    <link rel="stylesheet" href="../../css/my/details.css">
</head>
    <div class="aui-content">
        <ul class="aui-list aui-media-list">
            <li class="aui-list-item aui-list-item-middle" onclick="modify_avatar()">
                <div class="aui-media-list-item-inner">
                    <div class="aui-list-item-media">
                        <img src="../../image/head_portrait.png" id="avatar" class="aui-img-round aui-list-img-sm" style="width:4rem;height: 4rem;border-radius:50%">
                    </div>
                    <div class="aui-list-item-inner aui-list-item-arrow">
                        <div class="aui-list-item-text">
                            <div class="aui-list-item-title aui-font-size-14" id="user_name"></div>
                        </div>
                    </div>
                </div>
            </li>
        </ul>

        <ul class="aui-list aui-form-list aui-margin-t-10">
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        英文姓名
                    </div>
                    <div class="aui-list-item-input" >
                        <input type="text" name="english_name" placeholder="还未设置英文名" readonly>
                        <i></i>
                    </div>
                    <!--<div class="aui-list-item-label-icon">-->
                        <!--<i class="aui-iconfont icon-ai55"></i>-->
                    <!--</div>-->
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        邮箱
                    </div>
                    <div class="aui-list-item-input" >
                        <input type="text" name="email" placeholder="还未设置邮箱"  readonly>
                    </div>
                    <!--<div class="aui-list-item-label-icon">-->
                        <!--<i class="aui-iconfont icon-ai55"></i>-->
                    <!--</div>-->
                </div>
            </li>

            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        成本中心
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" name="cost_name"  placeholder="还未选择成本中心" readonly>
                    </div>
                    <!--<div class="aui-list-item-label-icon">-->
                        <!--<i class="aui-iconfont icon-ai55"></i>-->
                    <!--</div>-->
                </div>
            </li>
        </ul>
    </div>
</body>
</html>
<script type="text/javascript" src="../../script/aui/api.js"></script>
<script type="text/javascript" src="../../script/extend/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="../../script/config.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript">
    apiready = function() {
        api.parseTapmode();
        get_user_info();
        api.addEventListener({
            name: 'headerTop'
        }, function(ret, err) {
            if (ret.value.is_image == 1) {
                get_user_info();
            }
        });
    };

    //获取用户详情接口
    function get_user_info(){
        var param={};
        param.url = Config.user.userDetail;
        param.data = {};
        ajax(param,function(data){
            if (data.code == 1) {
                var res    = data.data;
                var avatar = res.avatar;
                var english_name = res.last_name +''+res.first_name;
                if (english_name.length == 0) {
                    english_name = '';
                }
                if (avatar.length == 0) {
                    avatar = "../../image/head_portrait.png";
                }
                $('#user_name').text(res.user_name);
                $('#avatar').attr('src',avatar);
                $('input[name=english_name]').val(english_name );
                $('input[name=email]').val(res.email);
                $('input[name=cost_name]').val(res.cost_name);
                localStorage.setItem('avatar',avatar);
            }
        })
    }

    //跳转到更换头像页面
    function modify_avatar(){
        openWin('modify_avatar_win', './modify_avatar_win.html');
    }

</script>
